Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix possible setting options list when camera uses exclusions #1548

Merged
merged 3 commits into from
Sep 16, 2021

Conversation

JonasVautherin
Copy link
Collaborator

Currently, parameters are refreshed when they are changed. If the camera definition defines an "update" dependency (not sure when that's done), then a parameter that is modified triggers a refresh in those update dependencies.

However, what is currently missing is a way to refresh parameters that were excluded. Let's have a look using the python examples/camera_params.py example.

Without this PR, say the camera is in VIDEO mode, with exposure set to "Aperture Priority". The output will be:

=== Current settings ===

* CAM_MODE: PHOTO
* CAM_FOCUSMODE: Focus Mode
    -> Infinity
* CAM_EXPMODE: Exposure Mode
    -> Aperture Priority
* CAM_WBMODE: White Balance
    -> Auto
* CAM_EV: Exposure Compensation
    -> 0
* CAM_APERTURE: Aperture
    -> f/3.5
* CAM_ISO: ISO
    -> Auto
* CAM_IMGDEST: Image store
    -> Camera
* CAM_IMGSIZE: Image Size
    -> Large

Usage:
  p    print current (changeable) camera settings
  m    change camera mode
  s    change a setting

Note how there is no shutter option, because it is excluded by the aperture option. Now say you move to "Manual Exposure", the shutter option will not appear. This PR aims at fixing that, such that switching between "Manual", "Program Auto", "Shutter Priority" and "Aperture Priority" update the list accordingly.

This issue was first discovered in the MAVSDK-Swift sample app. I will test it there before setting this PR as "ready".

julianoes
julianoes previously approved these changes Sep 14, 2021
Comment on lines -489 to -491
if (_current_settings[parameter.first].needs_updating) {
continue;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed those lines because an exclusion does not depend on needs_updating. I could verify in the test camera_definition that the unit test below was wrong: it was exposing CAM_VIDFMT when it should actually have been excluded.

@@ -1633,14 +1633,15 @@ void CameraImpl::refresh_params()
// any other possible settings to change. However, we still would
// like to notify the current settings with this one change.
notify_current_settings();
notify_possible_setting_options();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one line is the actual fix I needed 😅

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, ok!

@JonasVautherin
Copy link
Collaborator Author

Working with the MAVSDK-Swift sample app!

@JonasVautherin JonasVautherin marked this pull request as ready for review September 16, 2021 09:11
@JonasVautherin
Copy link
Collaborator Author

Fedora CI issue is unrelated.

@julianoes julianoes merged commit 634f171 into main Sep 16, 2021
@julianoes julianoes deleted the fix-camera-params-exclusion branch September 16, 2021 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants